# component/SConscript
Import('env')
import os
with open(env['PROJECT_TOOL_S']) as f:
    exec(f.read())

if 'CONFIG_STACKFLOW_ENABLED' in os.environ:
    SRCS = []
    INCLUDE = []
    PRIVATE_INCLUDE = []
    REQUIREMENTS = []
    STATIC_LIB = []
    DYNAMIC_LIB = []
    DEFINITIONS = []
    DEFINITIONS_PRIVATE = []
    LDFLAGS = []
    LINK_SEARCH_PATH = []

    SRCS += Glob('stackflow/*.cpp')
    INCLUDE.append(ADir("stackflow"))
    PRIVATE_INCLUDE.append(ADir("stackflow/libzmq"))

    REQUIREMENTS += ['eventpp', 'utilities', 'zmq', 'simdjson_component']

    env['COMPONENTS'].append({'target':os.path.basename(env['component_dir']),
                            'SRCS':SRCS,
                            'INCLUDE':INCLUDE,
                            'PRIVATE_INCLUDE':PRIVATE_INCLUDE,
                            'REQUIREMENTS':REQUIREMENTS,
                            'STATIC_LIB':STATIC_LIB,
                            'DYNAMIC_LIB':DYNAMIC_LIB,
                            'DEFINITIONS':DEFINITIONS,
                            'DEFINITIONS_PRIVATE':DEFINITIONS_PRIVATE,
                            'LDFLAGS':LDFLAGS,
                            'LINK_SEARCH_PATH':LINK_SEARCH_PATH,
                            'REGISTER':'static'
                            })
